package com.healthy_software.api;

import ch.qos.logback.core.net.server.Client;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SmsConfig {

    /**
     * 创建阿里云短信服务的 Client，交给 Spring 容器管理
     * @return com.aliyun.dysmsapi20170525.Client
     */
    @Bean
    public com.aliyun.dysmsapi20170525.Client createClient() throws Exception {
        // 工程代码建议使用更安全的无AK方式，凭据配置方式请参见：https://help.aliyun.com/document_detail/378657.html。
        com.aliyun.credentials.Client credential = new com.aliyun.credentials.Client();
        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                .setCredential(credential);
        // 设置短信服务的 Endpoint
        config.endpoint = "dysmsapi.aliyuncs.com";

        // 返回 Client 实例
        return new com.aliyun.dysmsapi20170525.Client(config);
    }
}
